//
// Created by yuhaibo on 18-11-16.
//

#define LOG_TAG "OTA_HAL.SERVICE"

#include <hidl/HidlTransportSupport.h>
#include <log/log.h>
#include "Ota.h"

using namespace android;
using namespace vendor::ecarx::xma::ota::V1_0;

int main(int /* argc */, char** /* argv */) {
    ALOGE("register OTA_HAL service start");
    android::hardware::configureRpcThreadpool(1, true);
    // Ota ota;
    // status_t status = ota.registerAsService();

    auto service = std::make_unique<Ota>();
    status_t status = service->registerAsService();

    if (status != OK) {
        ALOGE("Unable to register OTA_HAL service (%d)", status);
        return 1;
    } else {
        ALOGE("register OTA_HAL service success !!!");
        //ALOGE("OTA_HAL IPCP VERSION is %d !!!", OTA_IPCP_VERSION);
    }

    android::hardware::joinRpcThreadpool();
    return 1;  // joinRpcThreadpool shouldn't exit
}